package schedulo.core.task.filter;

import java.util.Iterator;
import java.util.List;

import schedulo.core.task.Task;

public abstract class TaskFilter {
	public List<Task> filter(List<Task> unfilteredList) {
		Iterator<Task> itTask = unfilteredList.iterator();
		while (itTask.hasNext()) {
			Task t = itTask.next();

			// if task filtered by the filter, then remove the task
			if (isFiltered(t)) {
				itTask.remove();
			}
		}
		return unfilteredList;
	}

	public abstract boolean isFiltered(Task toFilter);
}
